(function(context){
	context.utils={
	   checkNumber:function(number) {
		  var checkResult = {
		    success : true,
		    msg : '号码校验通过'
		  };
		  if (/[^0-9]/.test(number)) {// 存在非数字
		    checkResult.success = false;
		    checkResult.msg = '您输入的号码有误，请重新输入';
		    return checkResult;
		  }
		  var l = number.length;
		  if ((l === 7 || l === 8) && number.charAt(0) !== '0') {
		    checkResult.success = false;
		    checkResult.msg = '您输入的号码有误，若输入固话号码，请加区号';
		  } else if (l !== 11 && l !== 12) {
		    checkResult.success = false;
		    checkResult.msg = '您输入的号码有误，请重新输入';
		  }
		  return checkResult;
		},
		checkTelephoneNumber:function(number){
		  var checkResult = {
		    success : true,
		    msg : '手机号码校验通过'
		  },
		  telephoneReg=/^[1][3,4,5,7,8,9][0-9]{9}$/;
		  var l = number.length;
		  if (l!==11||!telephoneReg.test(number)) {
		    checkResult.success = false;
		    checkResult.msg = '您输入的手机号码有误，请重新输入';
		  }
		  return checkResult;
		},
		createQueryStringJSONObject:function(queryString,decoded){
			var parameterSet=queryString.split('&'),parameter,jsonObject={};
			for (var i = 0; i < parameterSet.length; i++) {
				parameter=parameterSet[i].split('=');
				jsonObject[parameter[0]]=decoded?decodeURIComponent(parameter[1]):parameter[1];
			}
			return jsonObject;
		},
		getHeight:function(context, elems) {
		  var con;
		  if(context&&context.constructor===Array){
			  con=$(document);
			  elems=context;
		  }
		  else
			  con= context || $(document);
		  var height = con.height();
		  if (elems) {
		    for (var i = 0; i < elems.length; i++) {
		      height -= elems[i].outerHeight(true);
		    }
		  }
		  return height-20;
		},
	    isIeClient:function(version){
	    	if(version){
	    		var match=/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase());
	    		return match&&match[1]&&match[2]&&parseInt(match[2])==version; 
	    	}else   
	    	 return /msie/.test(navigator.userAgent.toLowerCase());
	    }
	};
})(window);

